<?php

/**
 * Club form base class.
 *
 * @method Club getObject() Returns the current form's model object
 *
 * @package    ehockey
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseClubForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'nombre_completo' => new sfWidgetFormInputText(),
      'nombre'          => new sfWidgetFormInputText(),
      'direccion'       => new sfWidgetFormInputText(),
      'ciudad'          => new sfWidgetFormInputText(),
      'codigo_postal'   => new sfWidgetFormInputText(),
      'provincia'       => new sfWidgetFormChoice(array('choices' => array('Buenos Aires' => 'Buenos Aires', 'Catamarca' => 'Catamarca', 'Chaco' => 'Chaco', 'Chubut' => 'Chubut', 'Cordoba' => 'Cordoba', 'Corrientes' => 'Corrientes', 'Entre Rios' => 'Entre Rios', 'Formosa' => 'Formosa', 'Jujuy' => 'Jujuy', 'La Pampa' => 'La Pampa', 'La Rioja' => 'La Rioja', 'Mendoza' => 'Mendoza', 'Misiones' => 'Misiones', 'Neuquen' => 'Neuquen', 'Rio Negro' => 'Rio Negro', 'Salta' => 'Salta', 'San Juan' => 'San Juan', 'San Luis' => 'San Luis', 'Santa Cruz' => 'Santa Cruz', 'Santa Fe' => 'Santa Fe', 'Santiago del Estero' => 'Santiago del Estero', 'Tierra del Fuego' => 'Tierra del Fuego', 'Tucuman' => 'Tucuman'))),
      'email'           => new sfWidgetFormInputText(),
      'telefono'        => new sfWidgetFormInputText(),
      'pagina_web'      => new sfWidgetFormInputText(),
      'activo'          => new sfWidgetFormInputCheckbox(),
      'observaciones'   => new sfWidgetFormInputText(),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'nombre_completo' => new sfValidatorString(array('max_length' => 255)),
      'nombre'          => new sfValidatorString(array('max_length' => 255)),
      'direccion'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'ciudad'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'codigo_postal'   => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'provincia'       => new sfValidatorChoice(array('choices' => array(0 => 'Buenos Aires', 1 => 'Catamarca', 2 => 'Chaco', 3 => 'Chubut', 4 => 'Cordoba', 5 => 'Corrientes', 6 => 'Entre Rios', 7 => 'Formosa', 8 => 'Jujuy', 9 => 'La Pampa', 10 => 'La Rioja', 11 => 'Mendoza', 12 => 'Misiones', 13 => 'Neuquen', 14 => 'Rio Negro', 15 => 'Salta', 16 => 'San Juan', 17 => 'San Luis', 18 => 'Santa Cruz', 19 => 'Santa Fe', 20 => 'Santiago del Estero', 21 => 'Tierra del Fuego', 22 => 'Tucuman'))),
      'email'           => new sfValidatorString(array('max_length' => 255)),
      'telefono'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'pagina_web'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'activo'          => new sfValidatorBoolean(array('required' => false)),
      'observaciones'   => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorAnd(array(
        new sfValidatorDoctrineUnique(array('model' => 'Club', 'column' => array('nombre_completo'))),
        new sfValidatorDoctrineUnique(array('model' => 'Club', 'column' => array('nombre'))),
      ))
    );

    $this->widgetSchema->setNameFormat('club[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Club';
  }

}
